package com.zw.cc.example;

import com.zw.cc.redis.ShardedJedisSentinelTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * create by zhaowz
 *
 * 简单 example 具体方法 见 {@link ShardedJedisSentinelTemplate}
 *
 * @date 2017/11/9
 */
@Service
public class Operation {

    @Autowired
    private ShardedJedisSentinelTemplate redisTemplate;

    public void setString() {
        redisTemplate.set("key1", "message");
    }

    public String  getbykey() {
       return redisTemplate.get("key1");
    }

    public void setList(List<String> list) {
        redisTemplate.addList("listKey", list);
    }

    public List<String> getLsit(String key) {
        return redisTemplate.getList(key);
    }


}
